package abstractEntities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import entities.Tutorial;
import entities.User;
import entitiesIds.UsertutorialId;

/**
 * AbstractUsertutorial entity provides the base persistence definition of the
 * Usertutorial entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractUsertutorial implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 4658626865880581593L;
	private UsertutorialId id;
	private Tutorial tutorial;
	private User user;
	private Integer ranting;
	private Integer flag;

	// Constructors

	/** default constructor */
	public AbstractUsertutorial() {
	}

	/** minimal constructor */
	public AbstractUsertutorial(UsertutorialId id, Tutorial tutorial,
			User user, Integer flag) {
		this.id = id;
		this.tutorial = tutorial;
		this.user = user;
		this.flag = flag;
	}

	/** full constructor */
	public AbstractUsertutorial(UsertutorialId id, Tutorial tutorial,
			User user, Integer ranting, Integer flag) {
		this.id = id;
		this.tutorial = tutorial;
		this.user = user;
		this.ranting = ranting;
		this.flag = flag;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idUser", column = @Column(name = "idUser", nullable = false)),
			@AttributeOverride(name = "idTutorial", column = @Column(name = "idTutorial", nullable = false)) })
	public UsertutorialId getId() {
		return this.id;
	}

	public void setId(UsertutorialId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idTutorial", nullable = false, insertable = false, updatable = false)
	public Tutorial getTutorial() {
		return this.tutorial;
	}

	public void setTutorial(Tutorial tutorial) {
		this.tutorial = tutorial;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idUser", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "ranting")
	public Integer getRanting() {
		return this.ranting;
	}

	public void setRanting(Integer ranting) {
		this.ranting = ranting;
	}

	@Column(name = "flag", nullable = false)
	public Integer getFlag() {
		return this.flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

}